Skip to content

Refactor VerifyEmailController to use fulfill() #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

michaelnabil230
Copy link
Contributor

@michaelnabil230 michaelnabil230 commented Jul 5, 2025

This pull request refactors the VerifyEmailController to utilize the built-in fulfill() method provided by EmailVerificationRequest.

By replacing the manual email verification logic with a call to $request->fulfill(), we align the implementation with Laravel’s internal conventions, improving code readability, maintainability, and reducing redundancy.

Changes:

  • Replaced manual hasVerifiedEmail() check, markEmailAsVerified() call, and Verified event dispatch with a single $request->fulfill() method call.
  • Preserved the existing redirect behavior after verification.

Benefits:

  • Cleaner, more idiomatic Laravel code.
  • Leverages framework-provided method designed for this exact purpose.
  • Easier future maintenance and consistency with Laravel best practices.

@michaelnabil230 michaelnabil230 changed the title Use fulfill in the EmailVerificationRequest Refactor VerifyEmailController to use fulfill() Jul 5, 2025
@taylorotwell taylorotwell merged commit ca6ad3a into laravel:main Jul 24, 2025
2 checks passed
@michaelnabil230 michaelnabil230 deleted the clean branch July 24, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants